﻿Imports DTO
Imports System.Data.OleDb
Public Class ChucVuDAO

    Public Function CapNhatChucVu(ByVal sql As String) As Integer
        DataProvider.OpenConnecttion()
        Dim kq As Integer = DataProvider.ExecInsert(sql)
        DataProvider.CloseConnect()
        Return kq
    End Function

    Public Function ThemChucVu(ByVal sql As String) As Integer
        DataProvider.OpenConnecttion()
        Dim kq As Integer = DataProvider.ExecInsert(sql)
        DataProvider.CloseConnect()
        Return kq
    End Function

    Public Function LayDSChucVu() As List(Of ChucVuDTO)
        Dim sql As String = "Select MaChucVu,TenChucVu From CHUCVU"
        DataProvider.OpenConnecttion()
        Dim reader As OleDbDataReader = DataProvider.ExecSelect(sql)
        Dim ds As New List(Of ChucVuDTO)()
        While reader.Read()
            Dim cv As New ChucVuDTO()
            cv.MaChucVu = reader.GetInt32(0)
            cv.TenChucVu = reader.GetString(1)
            ds.Add(cv)
        End While
        DataProvider.CloseConnect()
        Return ds
    End Function
End Class
